<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>用户注册</title>
    <script src="jquery.min.js"></script>
    <style>
        *{
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }
        body{
            font-size: 14px;
        }
        .container{
            width: 600px;
            height: 600px;
            /*border: 1px solid #808080;*/
            /*border-radius: 3px;*/
            margin: 0 auto;
            margin-top: 40px;
            padding: 10px;
        }
        .form-group{
            overflow: hidden;
            line-height: 40px;
            margin-bottom: 20px;
        }
        .label{
            text-align: left;
            width: 20%;
            float: left;
        }
        .control{
            width: 50%;
            float: left;
            margin-right: 5%;
        }
        .control input[type="text"],input[type="password"]{
            width: 100%;
            padding: 10px;
            border: 1px solid darkgray;
            border-radius: 2px;

        }
        .container form{
            margin-top: 20px;
            margin-bottom: 50px;
        }

        form .submit{
            border: 1px solid #808080;
            border-radius: 3px;
            height: 40px;
            width: 20%;
        }
    </style>
    <script>
        $(function(){
            $('#submit').click(function(){
                return validate();
            });
            $('#password').change(function(){

            });
            $('#password-confirm').change(function(){
                $this = $(this);
                $pass = $('#password');
                if($this.val() !== $pass.val()){
                    $this.parents('.form-group').append('<p style="color: red">两次输入的密码不一样</p>');
                }
            })
        })
        function validate(){
            return true;
        }
    </script>
</head>
<body>

<div class="container">
    <h1 style="text-align: center"><span>用户注册</span></h1>
    <form>
        <div class="form-group">
            <div class="label">
                <label for="username">用户名:</label>
            </div>
            <div class="control">
                <input type="text" id="username" name="username" placeholder="用户名">
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label for="nickname">昵称:</label>
            </div>
            <div class="control">
                <input type="text" id="nickname" name="nickname" placeholder="昵称">
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label for="password">密码:</label>
            </div>
            <div class="control">
                <input type="password" id="password" name="password" placeholder="密码">
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label for="password-confirm">确认密码:</label>
            </div>
            <div class="control">
                <input type="password" id="password-confirm" placeholder="确认密码">
            </div>
        </div>
        <div class="form-group">
            <div class="label">
                <label for="captcha">验证码:</label>
            </div>
            <div class="control">
                <input type="text" id="captcha" placeholder="验证码">
            </div>
        </div>
        <div class="form-group">
            <div style="text-align: center">
                <button type="submit" id="submit" class="submit">注册</button>
            </div>
        </div>
    </form>
</div>
</body>
</html>